//package bbkj.org.cn.config;
//
//import java.nio.charset.Charset;
//
//import org.apache.skywalking.apm.toolkit.log.logback.v1.x.log.GRPCLogClientAppender;
//import org.slf4j.LoggerFactory;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//import ch.qos.logback.classic.Level;
//import ch.qos.logback.classic.Logger;
//import ch.qos.logback.classic.LoggerContext;
//import ch.qos.logback.classic.encoder.PatternLayoutEncoder;
//import ch.qos.logback.classic.spi.ILoggingEvent;
//
//@Configuration
//public class LogConfig {
//    private Level level = Level.INFO;
//
//    @Bean
//    public GRPCLogClientAppender logAppenderConfigrution() {
//        LoggerContext context = (LoggerContext)LoggerFactory.getILoggerFactory();
////        context.reset();
//        Logger root = context.getLogger("ROOT");
//        GRPCLogClientAppender<ILoggingEvent> appender = new GRPCLogClientAppender<ILoggingEvent>();
//        appender.setName("skywalking");
//        PatternLayoutEncoder encoder = new PatternLayoutEncoder();
//        encoder
//            .setPattern("[%-5level][%contextName]%d{yyyy-MM-dd HH:mm:ss.SSS}[%thread][%X{traceId}] %logger - %msg%n");
//        encoder.setCharset(Charset.forName("UTF-8"));
//        encoder.setContext(context);
//
//        appender.setEncoder(encoder);
//        appender.setContext(context);
//        // root.setLevel(level);
//        root.addAppender(appender);
//        appender.start();
//        encoder.start();
//        return appender;
//    }
//}
